/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef API_VIDEO_VIDEO_RENDER_INTERFACE_H_
#define API_VIDEO_VIDEO_RENDER_INTERFACE_H_

#include "api/video/video_frame.h"
#include "api/video/video_scale_mode.h"
#include "api/video/video_sink_interface.h"

namespace webrtc {
class VideoRenderListener {
public:
    virtual void OnFirstFrameRendered() = 0;
};

class RTC_EXPORT VideoRenderInterface : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
 public:
  virtual ~VideoRenderInterface() = default;

  virtual void AttachHandle(void* handle) = 0;
  virtual bool Init(void* window, void* share_context, int width, int height) = 0;
  virtual void SizeChange(int width, int height) = 0;
  virtual void ClearColor(const std::vector<float>& rgba_color) = 0;
  virtual void Release() = 0;
  virtual void SetScaleType(webrtc::VideoScaleMode h_match_scale_type,
                            webrtc::VideoScaleMode h_mismatch_scale_type,
                            webrtc::VideoScaleMode v_match_scale_type,
                            webrtc::VideoScaleMode v_mismatch_scale_type) = 0;
  virtual void SetMirror(bool mirror) = 0;
  virtual bool GetMirror() const = 0;
  virtual std::string GetRenderId() const = 0;
  virtual bool Inited() const = 0;

  virtual void OnFrame(const webrtc::VideoFrame& frame) = 0;

  virtual void AddRenderListener(std::shared_ptr<VideoRenderListener> listener) = 0;
  virtual void RemoveRenderListener(std::shared_ptr<VideoRenderListener> listener) = 0;

};

}  // namespace rtc

#endif  // API_VIDEO_VIDEO_RENDER_INTERFACE_H_
